﻿// <copyright file="ProductIconTest.cs" company="Snowman Consulting">
//     Copyright (c) 2009 Snowman Consulting. All rights reserved.
// </copyright>

namespace SnowmanConsulting.ProductKeyManager.Test
{
    using System.Windows.Media.Imaging;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SnowmanConsulting.ProductKeyManager.Data;
    
    /// <summary>
    /// This is a test class for ProductIconTest and is intended
    /// to contain all ProductIconTest Unit Tests
    /// </summary>
    [TestClass()]
    public class ProductIconTest
    {
        /// <summary>
        /// test context
        /// </summary>
        private TestContext testContextInstance;

        /// <summary>
        /// Gets or sets the test context which provides
        /// information about and functionality for the current test run.
        /// </summary>
        public TestContext TestContext
        {
            get
            {
                return this.testContextInstance;
            }

            set
            {
                this.testContextInstance = value;
            }
        }

        /// <summary>
        /// A test for Image
        /// </summary>
        [TestMethod()]
        public void ImageTest()
        {
            string expected = "cmd.ico";
            ProductIcon target = new ProductIcon();
            target.IconUrl = expected;

            BitmapImage actual;
            actual = target.Image;

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual.UriSource.ToString(), true);
        }

        /// <summary>
        /// A test for IconUrl
        /// </summary>
        [TestMethod()]
        public void IconUrlTest()
        {
            ProductIcon target = new ProductIcon();
            string expected = "cmd.ico";
            string actual;
            target.IconUrl = expected;
            actual = target.IconUrl;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for ToString
        /// </summary>
        [TestMethod()]
        public void ToStringTest()
        {
            ProductIcon target = new ProductIcon();
            string expected = "cmd.ico";

            target.IconUrl = expected;

            string actual;
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for GetHashCode
        /// </summary>
        [TestMethod()]
        public void GetHashCodeTest()
        {
            string iconUrl = "cmd.ico";

            ProductIcon target = new ProductIcon();
            target.IconUrl = iconUrl;

            int expected = iconUrl.GetHashCode();
            int actual;
            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for Equals
        /// </summary>
        [TestMethod()]
        public void EqualsTest()
        {
            string iconUrl1 = "cmd.ico";
            string iconUrl2 = "delete.ico";

            ProductIcon target = new ProductIcon();
            target.IconUrl = iconUrl1;

            ProductIcon obj1 = new ProductIcon();
            obj1.IconUrl = iconUrl1;

            ProductIcon obj2 = new ProductIcon();
            obj2.IconUrl = iconUrl2;

            bool expected1 = true;
            bool actual1;

            bool expected2 = false;
            bool actual2;

            actual1 = target.Equals(obj1);
            actual2 = target.Equals(obj2);

            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
        }

        /// <summary>
        /// A test for ProductIcon Constructor
        /// </summary>
        [TestMethod()]
        public void ProductIconConstructorTest1()
        {
            ProductIcon target = new ProductIcon();
            Assert.IsNotNull(target);
        }

        /// <summary>
        /// A test for ProductIcon Constructor
        /// </summary>
        [TestMethod()]
        public void ProductIconConstructorTest()
        {
            string iconurl = "cmd.ico"; // TODO: Initialize to an appropriate value
            ProductIcon target = ProductIconHelper.CreateProductIcon(iconurl);

            Assert.IsNotNull(target);
            Assert.AreEqual(iconurl, target.IconUrl, true);
        }
    }
}
